package com.jiuli_travel.blog_service.controller;


import com.jiuli_travel.blog_service.model.dto.blog_comment.BlogCommentQueryRequest;
import com.jiuli_travel.blog_service.model.vo.BlogCommentVO;
import com.jiuli_travel.blog_service.service.IBlogCommentService;
import com.jiuli_travel.utils.PageDTO;
import com.jiuli_travel.utils.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/blogComments")
@Tag(name = "blog-comments")
public class BlogCommentsController {

    @Autowired
    private IBlogCommentService blogCommentsService;

    @GetMapping("/selectInitBlogCommentsByPage")
    /**
     * 分页获取某个博客的评论信息（底层的回复也是分页查询）
     */
    @Operation(summary = "hcik")
    public Result selectInitBlogCommentsByPage(Long blogId){
        PageDTO<BlogCommentVO> blogCommentVOPageDTO = blogCommentsService.selectInitBlogCommentsByPage(blogId);
        if(blogCommentVOPageDTO == null){
            return Result.fail("暂无数据");
        }
        return Result.ok(blogCommentVOPageDTO);
    }
}
